package com.jianguozh.difs.support.service.constant.enums;

import cn.hutool.core.util.ArrayUtil;
import com.baomidou.mybatisplus.annotation.IEnum;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonValue;
import com.jianguozh.difs.framework.annotation.EnumDesc;
import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 应用类型枚举
 *
 * @author hanrs
 * @email 4076130@qq.com
 * @since 2022/3/28 17:11
 */
@Getter
@AllArgsConstructor
@EnumDesc(title = "应用类型")
public enum ClientTypeEnum implements IEnum<String> {

    WEB("WEB", "web"),
    APP("APP", "app"),
    H5("H5", "h5");

    @JsonValue
    private final String value;
    private final String displayName;

    @JsonCreator
    public static ClientTypeEnum fromValue(String value) {
        return ArrayUtil.firstMatch(o -> o.getValue().equals(value), values());
    }

}
